from django.db import models
from MD_django.settings import *
# Create your models here.

class Googs(models.Model):
    name = models.CharField(max_length=32)
    price = models.IntegerField()
    img = models.CharField(max_length=32,null=True)
    status = models.CharField(max_length=64,null=True)
    addtime = models.CharField(max_length=64,null=True)


class Category(models.Model):
    name = models.CharField(max_length=32)
    status = models.ForeignKey(Googs,on_delete=models.CASCADE,null=True)

class YxRres(models.Model):
    yxname = models.CharField(max_length=32)

class UserRes(models.Model):
    usernmae = models.CharField(max_length=64)
    password = models.CharField(max_length=128)
    img = models.CharField(max_length=620)
    yxres = models.ForeignKey(YxRres,on_delete=models.CASCADE,null=True)

class UserRest(models.Model):
    usernmae = models.CharField(max_length=64)
    password = models.CharField(max_length=128)
    yxres = models.ForeignKey(YxRres,on_delete=models.CASCADE,null=True)

class UserH(models.Model):
    username = models.CharField(max_length=32)
    password = models.CharField(max_length=64)
    phone = models.IntegerField(null=True)
    email = models.CharField(max_length=32)

class RegIon(models.Model):
    name = models.CharField(max_length=32,verbose_name="地区")
    r_id = models.ForeignKey("self",on_delete=models.CASCADE,null=True)



#2020.3.27周考
class Author(models.Model):
    name = models.CharField(max_length=32)

class Book(models.Model):
    name = models.CharField(max_length=32,verbose_name="书名")
    price = models.IntegerField(verbose_name="价格")
    img = models.ImageField(verbose_name="封面",null=True)
    author_id = models.ForeignKey(Author,models.CASCADE,verbose_name="关联作者")

class Ass(models.Model):
    name = models.CharField(max_length=32)

class Bss(models.Model):
    name = models.CharField(max_length=32)
    price = models.IntegerField()
    img = models.CharField(max_length=32,null=True)
    status = models.CharField(max_length=64,null=True)
    ass_id = models.ForeignKey(Ass,models.CASCADE)

class Bsst(models.Model):
    name = models.CharField(max_length=32)
    price = models.IntegerField()
    status = models.CharField(max_length=64,null=True)
    ass_id = models.ForeignKey(Ass,on_delete=models.CASCADE)


class Ceshi(models.Model):
    name = models.CharField(max_length=32)
    password = models.CharField(max_length=128)


class AUth(models.Model):
    name = models.CharField(max_length=32)

class BKbook(models.Model):
    name = models.CharField(max_length=128)
    price = models.IntegerField()
    author_id = models.ForeignKey(AUth,on_delete=models.CASCADE)

class TuPian(models.Model):
    name = models.CharField(max_length=32)
    img = models.ImageField(null=True)



class BookS(models.Model):
    name = models.CharField(max_length=32)
    read = models.IntegerField(verbose_name="阅读量")
    commit = models.IntegerField(verbose_name="评论量")
    time = models.CharField(max_length=32)





